<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('订单信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>会员号：</label>
                                <input type="text" name="customerId"/>
                            </li>
                            <li>
                                <label>茶店编号：</label>
                                <input type="text" name="teaShopId"/>
                            </li>
                            <li>
                                <label>取餐码：</label>
                                <input type="text" name="foodDeliveryCode"/>
                            </li>
                            <li>
                                <label>总价格：</label>
                                <input type="text" name="price"/>
                            </li>
                            <li>
                                <label>发货方式：</label>
                                <select name="modeOfDespatch" th:with="type=${@dict.getType('mode_of_despatch')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>开始日期：</label>
                                <input type="text" class="time-input" placeholder="请选择订单日期" name="dateStart"/>
                            </li>
                            <li>
                                <label>结束日期：</label>
                                <input type="text" class="time-input" placeholder="请选择订单日期" name="dateEnd"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:order:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:order:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:order:export">
                    <i class="fa fa-download"></i> 导出
                </a>
                <a class="btn btn-info" onclick="salesVolumn()">
                    <i class="fa fa-bar-chart-o"></i> 每日销量柱状图
                </a>
                <a class="btn btn-info" onclick="linearRegression()">
                    <i class="fa fa-line-chart"></i> 线性回归
                </a>
<!--                <a class="btn btn-info" onclick="kmeans()">-->
<!--                    <i class="fa fa-area-chart"></i> K均值聚类-->
<!--                </a>-->
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />

     <th:block th:include="include :: echarts-js" />

     <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:order:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:order:remove')}]];
        var modeOfDespatchDatas = [[${@dict.getType('mode_of_despatch')}]];
        var prefix = ctx + "system/order";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "订单信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'customerId',
                    title: '会员号'
                },
                {
                    field: 'teaShopAddress',
                    title: '茶店地址'
                },
                {
                    field: 'foodDeliveryCode',
                    title: '取餐码'
                },
                {
                    field: 'content',
                    title: '购买内容'
                },
                {
                    field: 'price',
                    title: '总价格'
                },
                {
                    field: 'modeOfDespatch',
                    title: '发货方式',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(modeOfDespatchDatas, value);
                    }
                },
                {
                    field: 'date',
                    title: '订单日期'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        /* 查看销量 */
		function salesVolumn() {
		    var url = prefix + '/salesVolumn';
		    $.modal.open("查看销量", url);
		}

         function linearRegression() {
		    var url = prefix + '/linearRegression';
		    $.modal.open("线性回归", url);
		}

        function kmeans() {
		    var url = prefix + '/kmeans';
		    $.modal.open("K均值聚类", url);
		}
    </script>


</body>
</html>